#build stage
FROM golang:alpine AS builder

WORKDIR /go/src/app
COPY . .

RUN go env -w GO111MODULE=on
RUN go env -w GOPROXY=https://goproxy.cn,direct
RUN go mod tidy
RUN go build -o /go/bin/app .

#final stage
FROM alpine:latest
COPY --from=builder /go/bin/app /app
ENTRYPOINT ./app

